package com.zjj.jvm.reference;

import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;

/**
 * @author zhanglei.zjj
 * @description 演示虚引用的使用
 * @date 2023/3/14 22:14
 */
public class TestPhantomReference {
    public static void main(String[] args) {
        ReferenceQueue<Object> queue = new ReferenceQueue<>();
        PhantomReference<Object> reference = new PhantomReference<>(new Object(), queue);
        System.out.println(reference.get());
    }
}
